package org.chat.client.model;


import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * 
 * @author Master
 *@version 1.1
 */
public class User implements IsSerializable {
	

	

	private String name;
	private Date update;
	private String avatar="org/chat/client/images/avatar.jpg";

	/**
	 * 
	 * @param name le nom de l'utilisateur
	 */
	public User(String name) {
		this.name = name;
		update=new Date();
		
		
		
	}
	
	public User() {
		
	}
	
	

	public boolean equals(Object obj) {
		if (obj == this) {
			return true;
		}

		if (obj instanceof User) {
			User user = (User) obj;

			return name.equals(user.name);
		}

		return false;
	}

	/**
	 * 
	 * @return le nom de l'utilisateur
	 */
	public String getName() {
		return name;
	}


	public int hashCode() {
		return name.hashCode();
	}

	
	/**
	 * Mettre a jour la date 
	 * @param update la date 
	 */
	public void setUpdate(Date update) {
		this.update = update;
	}
	
	/**
	 * 
	 * @return la date de connection ou la dernier date d'acctiviter   
	 */
	public Date getUpdate() {
		return update;
	}
	
	public String getAvatar() {
		return avatar;
	}
	
	

	


}
